package com.pc.service.impl;

import com.pc.enrty.ShoppingTrolley;
import com.pc.mapper.ShoppingTrolleyMapper;
import com.pc.pojo.Cart;
import com.pc.service.ShoppingTrolleyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class ShoppingTrolleyServiceImpl implements ShoppingTrolleyService {
    @Autowired
    private ShoppingTrolleyMapper shoppingTrolleyMapper;
    @Override
    public ArrayList<Cart> findByUidAndFid(Cart cart) {
        return shoppingTrolleyMapper.selectByUidAndFid(cart);
    }

    @Override
    public boolean addTrolley(ShoppingTrolley shoppingTrolley) {
        return shoppingTrolleyMapper.insertTrolley(shoppingTrolley)==1?true:false;
    }

    @Override
    public boolean updateByUidAndFid(ShoppingTrolley shoppingTrolley) {
        return shoppingTrolleyMapper.updateByUidAndFid(shoppingTrolley)==1?true:false;
    }

    @Override
    public boolean removeByUidAndFid(ShoppingTrolley shoppingTrolley) {
        return shoppingTrolleyMapper.deleteByUidAndFid(shoppingTrolley)>=0?true:false;
    }

    @Override
    public ArrayList<Cart> findByUidAndFid2(ShoppingTrolley shoppingTrolley) {
        return shoppingTrolleyMapper.selectByUidAndFid2(shoppingTrolley);
    }

    @Override
    public ArrayList<Cart> findll(ShoppingTrolley shoppingTrolley) {
        return shoppingTrolleyMapper.selectOutFid(shoppingTrolley);
    }


}
